#include "apiclienttest.h"
#include "api/apiclient.h"
#include "api/apiinfo.h"
#include <thread>

ApiClientTest::ApiClientTest(QObject* parent)
{
}
ApiClientTest::~ApiClientTest()
{
}
void ApiClientTest::initTestCase()
{
	std::cout << "CLASS:ApiClient START" << std::endl;
	//设置API根地址
	ApiInfo::setRootUrl("http://192.168.6.27:8888/corexapi");
	//设置版本号
	ApiInfo::setVersionNo("V8.0.1.0");
}
void ApiClientTest::tstTest()
{
	ApiClient::test();
}
void ApiClientTest::tstSystemDateTime()
{
	for (int i = 0; i < 10; ++i)
	{
		const QDateTime date = ApiClient::systemDateTime();
		std::cout << i << " systemDateTime:" << date.toString("yyyy-MM-ddTHH:mm:ss.zzz").toStdString() << std::endl;
		// 暂停1秒
		std::this_thread::sleep_for(std::chrono::seconds(1));
	}
}
void ApiClientTest::cleanupTestCase()
{
	std::cout << "CLASS:ApiClient END" << std::endl;
}
int main(int argc, char** argv)
{
	ApiClientTest tc;
	return QTest::qExec(&tc, argc, argv);// qExec 会把失败信息打印到 stdout
}